package com.rz.paas.test.SettingDetail

import android.content.Context
import android.content.Intent
import android.graphics.SurfaceTexture
import android.os.Bundle
import com.rz.paas.test.R
import com.rz.paas.test.base.MiddleActivity
import com.rz.paas.test.camera.CameraHandle
import com.rz.paas.test.constant.toast
import kotlinx.android.synthetic.main.activity_camera_detection.*
import kotlinx.android.synthetic.main.custom_action_bar.*

class CameraDetectionActivity : MiddleActivity() {

    companion object {
        const val CUSTOM_PUSH = "OPTION_ID"
        fun open(context: Context) {
            val intent = Intent(context, CameraDetectionActivity::class.java)
            context.startActivity(intent)
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_camera_detection)
        sub_title.text = "设置"
        main_title.text = "摄像头"

        var openCamera = CameraHandle.getInstance().openCamera()
        if (openCamera){
            CameraHandle.getInstance().setPreviewDisplay(camera_preview_sv.holder)
        }
       else{
            toast("摄像头没打开")
        }

    }

    override fun onDestroy() {
        super.onDestroy()
        CameraHandle.getInstance().stopCamera()
    }
}